#include "cmainwindow.h"

#include <QHBoxLayout>
#include <QSplitter>
#include <QVBoxLayout>

CMainWindow::CMainWindow(QWidget *parent) : CBaseWidget(parent)
{
    initWidget();
    initUI();
    initConnect();
}

CMainWindow::~CMainWindow()
{
}

void CMainWindow::initUI()
{
    m_bottomWidget = new CBaseWidget();
    m_bottomWidget->setObjectName("bottomWidget");
    m_bottomWidget->setStyleSheet(
        "CBaseWidget{background-color:rgb(255, 0, 255);color:rgb(0, 0, 0);}");

    m_leftTopWidget = new CBaseWidget();
    m_leftTopWidget->setObjectName("leftTopWidget");
    m_leftTopWidget->setStyleSheet(
        "CBaseWidget{background-color:rgb(255, 0, 255);color:rgb(0, 0, 0);}");

    m_rightTopWidget = new CBaseWidget();
    m_rightTopWidget->setObjectName("rightTopWidget");
    m_rightTopWidget->setStyleSheet(
        "CBaseWidget{background-color:rgb(255, 0, 255);color:rgb(0, 0, 0);}");

    m_middleTopWidget = new CBaseWidget();
    m_middleTopWidget->setObjectName("middleTopWidget");
    m_middleTopWidget->setStyleSheet(
        "CBaseWidget{background-color:rgb(255, 0, 255);color:rgb(0, 0, 0);}");

    QVBoxLayout *vLayout = new QVBoxLayout();
    vLayout->setMargin(0);

    QSplitter *splitterleft = new QSplitter(Qt::Horizontal);
    splitterleft->setStyleSheet("background-color:rgb(255, 0, 0);");
    splitterleft->addWidget(m_leftTopWidget);
    splitterleft->addWidget(m_middleTopWidget);
    splitterleft->setStretchFactor(3, 4);
    splitterleft->setSizes(QList<int>() << 300 << 400);
    QSplitter *spilterright = new QSplitter(Qt::Horizontal);
    spilterright->setStyleSheet("background-color:rgb(255, 0, 0);");
    spilterright->setSizes(QList<int>() << 700 << 300);
    spilterright->addWidget(m_rightTopWidget);
    spilterright->addWidget(splitterleft);
    spilterright->setStretchFactor(3, 7);

    QSplitter *splitter = new QSplitter(Qt::Vertical);

    splitter->setStyleSheet("background-color:rgb(255, 0, 0);");
    splitter->addWidget(spilterright);
    splitter->addWidget(m_bottomWidget);
    splitter->setStretchFactor(4, 6);
    spilterright->setSizes(QList<int>() << 400 << 600);
    vLayout->addWidget(splitter);
    setLayout(vLayout);
}

void CMainWindow::initConnect()
{
}
